home *** CD-ROM | disk | FTP | other *** search
-
-
-
- iiiiooooccccttttllll((((DDDD2222)))) iiiiooooccccttttllll((((DDDD2222))))
-
-
-
- NNNNAAAAMMMMEEEE
- _iiii_oooo_cccc_tttt_llll - control a character device
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_tttt_yyyy_pppp_eeee_ssss_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_cccc_rrrr_eeee_dddd_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_ffff_iiii_llll_eeee_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_eeee_rrrr_rrrr_nnnn_oooo_...._hhhh_>>>>
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_yyyy_ssss_////_dddd_dddd_iiii_...._hhhh_>>>>
- _iiii_nnnn_tttt _p_r_e_f_i_x_iiii_oooo_cccc_tttt_llll_((((_dddd_eeee_vvvv______tttt _d_e_v_,,,, _iiii_nnnn_tttt _c_m_d_,,,, _vvvv_oooo_iiii_dddd _****_a_r_g_,,,,
- _iiii_nnnn_tttt _m_o_d_e_,,,, _cccc_rrrr_eeee_dddd______tttt _****_c_r_p_,,,, _iiii_nnnn_tttt _****_r_v_a_l_p_))))_;;;;
-
- AAAArrrrgggguuuummmmeeeennnnttttssss
- _d_e_v Device number.
-
- _c_m_d Command argument the driver _iiii_oooo_cccc_tttt_llll routine interprets as the
- operation to be performed.
-
- _a_r_g Passes parameters between the user and the driver. The
- interpretation of the argument is dependent on the command
- and the driver. For example, the argument can be an
- integer, or it can be the address of a user structure
- containing driver or hardware settings.
-
- _m_o_d_e Contains the file modes set when the device was opened. The
- driver can use this to determine if the device was opened
- for reading (_FFFF_RRRR_EEEE_AAAA_DDDD), writing (_FFFF_WWWW_RRRR_IIII_TTTT_EEEE), and so on. See
- _oooo_pppp_eeee_nnnn(D2) for a description of the values.
-
- _c_r_p Pointer to the user credential structure.
-
- _r_v_a_l_p Pointer to the return value for the calling process. The
- driver may elect to set the value if the _iiii_oooo_cccc_tttt_llll(D2) succeeds.
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- The _iiii_oooo_cccc_tttt_llll(D2) routine provides non-STREAMS character drivers with an
- alternate entry point that can be used for almost any operation other
- than a simple transfer of data.
-
- The _iiii_oooo_cccc_tttt_llll routine is basically a _ssss_wwww_iiii_tttt_cccc_hhhh statement, with each _cccc_aaaa_ssss_eeee
- definition corresponding to a different _iiii_oooo_cccc_tttt_llll command identifying the
- action to be taken.
-
- RRRReeeettttuuuurrrrnnnn VVVVaaaalllluuuueeeessss
- The _iiii_oooo_cccc_tttt_llll routine should return 0 on success, or the appropriate error
- number on failure. The system call will usually return 0 on success or
- -1 on failure. However, the driver can choose to have the system call
- return a different value on success by passing the value through the
- _r_v_a_l_p pointer.
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- iiiiooooccccttttllll((((DDDD2222)))) iiiiooooccccttttllll((((DDDD2222))))
-
-
-
- UUUUSSSSAAAAGGGGEEEE
- This entry point is optional, and is valid for character device drivers
- only.
-
- Most often, _iiii_oooo_cccc_tttt_llll is used to control device hardware parameters and
- establish the protocol used by the driver in processing data. I/O
- control commands are used to implement terminal settings, to format disk
- devices, to implement a trace driver for debugging, and to flush queues.
-
- If the third argument, _a_r_g, is a pointer to user space, the driver can
- use _cccc_oooo_pppp_yyyy_iiii_nnnn(D3) and _cccc_oooo_pppp_yyyy_oooo_uuuu_tttt(D3) to transfer data between kernel and user
- space.
-
- STREAMS drivers do not have _iiii_oooo_cccc_tttt_llll routines. The stream head converts I/O
- control commands to _MMMM______IIII_OOOO_CCCC_TTTT_LLLL messages, which are handled by the driver's
- _pppp_uuuu_tttt(D2) or _ssss_rrrr_vvvv(D2) routine.
-
- SSSSyyyynnnncccchhhhrrrroooonnnniiiizzzzaaaattttiiiioooonnnn CCCCoooonnnnssssttttrrrraaaaiiiinnnnttttssss
- The _iiii_oooo_cccc_tttt_llll routine has user context and can sleep.
-
- WWWWaaaarrrrnnnniiiinnnnggggssss
- An attempt should be made to keep the values for driver-specific I/O
- control commands distinct from others in the system. Each driver's I/O
- control commands are unique, but it is possible for user-level code to
- access a driver with an I/O control command that is intended for another
- driver, which can have serious results.
-
- A common method to assign I/O control command values that are less apt to
- be duplicated is to compose the commands from some component unique to
- the driver (such as a module name or ID), and a counter, as in:
- _####_dddd_eeee_ffff_iiii_nnnn_eeee _PPPP_RRRR_EEEE_FFFF_IIII_XXXX _((((_''''_hhhh_''''_<<<<_<<<<_1111_6666_||||_''''_dddd_''''_<<<<_<<<<_8888_))))
- _####_dddd_eeee_ffff_iiii_nnnn_eeee _CCCC_OOOO_MMMM_MMMM_AAAA_NNNN_DDDD_1111 _((((_PPPP_RRRR_EEEE_FFFF_IIII_XXXX_||||_1111_))))
- _####_dddd_eeee_ffff_iiii_nnnn_eeee _CCCC_OOOO_MMMM_MMMM_AAAA_NNNN_DDDD_2222 _((((_PPPP_RRRR_EEEE_FFFF_IIII_XXXX_||||_2222_))))
- _####_dddd_eeee_ffff_iiii_nnnn_eeee _CCCC_OOOO_MMMM_MMMM_AAAA_NNNN_DDDD_3333 _((((_PPPP_RRRR_EEEE_FFFF_IIII_XXXX_||||_3333_))))
- RRRREEEEFFFFEEEERRRREEEENNNNCCCCEEEESSSS
- _cccc_oooo_pppp_yyyy_iiii_nnnn(D3), _cccc_oooo_pppp_yyyy_oooo_uuuu_tttt(D3), _dddd_rrrr_vvvv______pppp_rrrr_iiii_vvvv(D3), _eeee_rrrr_rrrr_nnnn_oooo_ssss(D5), _oooo_pppp_eeee_nnnn(D2)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-